namespace TestServices.Tests
{
    using System;
    using Microsoft.Pex.Framework;
    using Microsoft.Pex.Framework.Validation;
    using NUnit.Framework;
    using TestServices;

    [TestFixture]
    [PexClass(typeof(DialogBrain))]
    [PexAllowedExceptionFromTypeUnderTest(typeof(ArgumentException), AcceptExceptionSubtypes = true)]
    [PexAllowedExceptionFromTypeUnderTest(typeof(InvalidOperationException))]
    public partial class DialogBrainTest
    {
        [PexMethod]
        public string GetResult(
            [PexAssumeUnderTest]DialogBrain target,
            string xInp,
            string yInp
        )
        {
            string result = "";
            if (target != null)
            {
                result = target.GetResult(xInp, yInp);
            }
            return result;
        }


        [PexMethod]
        public DialogBrain Constructor(IServiceProvider serviceProvider)
        {
            Assert.IsNull(serviceProvider, "serviceProvider");
            DialogBrain target = new DialogBrain(serviceProvider);
            return target;
        }

        ///////////////////////////////////////////////////////////////////////////////////
        [Test]
        [ExpectedException(typeof(ArgumentNullException))]
        public void Constructor793()
        {
            DialogBrain dialogBrain = this.Constructor((IServiceProvider)null);
            PexAssert.IsNotNull((object)dialogBrain);
        }

        [Test]
        [ExpectedException(typeof(ArgumentNullException))]
        public void GetResultThrowsTermDestructionException377()
        {
            DialogBrain dialogBrain = new DialogBrain((IServiceProvider)null);
            string s = this.GetResult(dialogBrain, (string)null, (string)null);
        }

        [Test]
        public void GetResultOk01()
        {
            ServiceProvider serviceProvider = new ServiceProvider();
            serviceProvider.AddService(typeof(ICalc), new Calc());
            serviceProvider.AddService(typeof(IConvertor), new Convertor());

            DialogBrain dialogBrain = new DialogBrain(serviceProvider);
            string s = this.GetResult(dialogBrain, "1", "2");
            Assert.AreEqual("3",s);
        }

    }
}
